#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: db_info.py 
@version:
@time: 2021/08/11 
"""
source = "source"
target = "target"
source_and_target = "source_and_target"
__all__ = ["Mysql", 'Mariadb', "MongoDB", "Oracle",
           'MysqlPXC',
           "Postgres", "Sqlserver",
           "DM", "Greenplum", "Kafka", "ES",
           'GaussDB200', 'KunDB', 'DB2',
           "ClickHouse", "TiDB", "HANA",
           'MQ', 'AdbPostgres', 'AdbMYSQL',
           'KUDU', 'Hive', "HBase", 'Dummy',
           "Redis", 'Gbase8a', 'Sybase'
           ]


class MysqlPXC:
    database_type = "mysql pxc"

    mysql_pxc_master_source = {
        "name": "mysql_pxc_master_source",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33077",
        "database_name": "test",
        "database_username": "root",
        "plain_password": "tapdata",
        "connection_type": source_and_target
    }

    mysql_pxc_slave_1_source = {
        "name": "mysql_pxc_slave_1_source",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33078",
        "database_name": "test",
        "database_username": "root",
        "plain_password": "tapdata",
        "connection_type": source_and_target
    }

    mysql_pxc_slave_2_source = {
        "name": "mysql_pxc_slave_2_source",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33079",
        "database_name": "test",
        "database_username": "root",
        "plain_password": "tapdata",
        "connection_type": source_and_target
    }

    mysql_pxc_master_target = {
        "name": "mysql_pxc_master_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33077",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "tapdata",
        "connection_type": source_and_target
    }

    mysql_pxc_slave_1_target = {
        "name": "mysql_pxc_slave_1_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33078",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "tapdata",
        "connection_type": source_and_target
    }

    mysql_pxc_slave_2_target = {
        "name": "mysql_pxc_slave_2_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33079",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "tapdata",
        "connection_type": source_and_target
    }


class Sybase:
    database_type = "sybase ase"
    others = {}

    sybase01 = {
        "name": "sybase01",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5000",
        "database_name": "testdb",
        "database_owner": "tester",
        "database_username": "sa",
        "plain_password": "myPassword",
        "connection_type": source
    }


class Gbase8a:
    database_type = "gbase-8a"

    gbase01 = {
        "name": "gbase01",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5258",
        "database_name": "gbase",
        "database_username": "root",
        "plain_password": "root",
        "connection_type": source
    }

    gbase_source = {
        "name": "gbase_source",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5258",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "root",
        "connection_type": source
    }


class Redis:
    database_type = 'redis'

    auto_redis_target_test = {
        'name': 'auto_redis_target_test',
        'database_type': database_type,
        "database_host": "192.168.1.183",
        "database_port": "16379",
        "database_name": "0",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
        "database_owner": "",
        "connection_type": source, }

    auto_redis_target_00 = {
        'name': 'auto_redis_target_00',
        'database_type': database_type,
        "database_host": "192.168.1.183",
        "database_port": "16379",
        "database_name": "0",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
        "database_owner": "",
        "connection_type": source, }
    auto_redis_target_01 = {
        'name': 'auto_redis_target_01',
        'database_type': database_type,
        "database_host": "192.168.1.183",
        "database_port": "16379",
        "database_name": "1",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
        "database_owner": "",
        "connection_type": source, }
    auto_redis_target_02 = {
        'name': 'auto_redis_target_02',
        'database_type': database_type,
        "database_host": "192.168.1.183",
        "database_port": "16379",
        "database_name": "2",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
        "database_owner": "",
        "connection_type": source, }
    auto_redis_target_03 = {
        'name': 'auto_redis_target_03',
        'database_type': database_type,
        "database_host": "192.168.1.183",
        "database_port": "16379",
        "database_name": "3",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
        "database_owner": "",
        "connection_type": source, }


class Dummy:
    database_type = 'dummy db'

    auto_dummy_source_test = {
        'name': 'auto_dummy_source_test',
        'database_type': database_type,
        "database_host": "",
        "database_port": "",
        "database_name": "",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
        "database_owner": "",
        "connection_type": source,
    }

    auto_dummy_source = {
        'name': 'auto_dummy_source',
        'database_type': database_type,
        "database_host": "",
        "database_port": "",
        "database_name": "",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
        "database_owner": "",
        "connection_type": source,
    }

    auto_dummy_target = {
        'name': 'auto_dummy_target',
        'database_type': database_type,
        "database_host": "",
        "database_port": "",
        "database_name": "",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
        "database_owner": "",
        "connection_type": target,
    }


class GaussDB200:
    database_type = 'gaussdb200'

    auto_gaussdb_source_test = {
        'name': 'auto_gaussdb_source_test',
        'connection_type': source_and_target,
        'database_host': '192.168.1.183',
        'database_port': '15437',
        'database_type': database_type,
        'database_name': "postgres",
        'database_owner': "public",
        'database_username': "gaussdb",
        "plain_password": "Gotapd8@"
    }

    # for tester
    auto_gaussdb_source = {
        'name': 'auto_gaussdb_source',
        'connection_type': source_and_target,
        'database_host': '192.168.1.183',
        'database_port': '15437',
        'database_type': database_type,
        'database_name': "postgres",
        'database_owner': "source",
        'database_username': "gaussdb",
        "plain_password": "Gotapd8@"
    }
    auto_gaussdb_target = {
        'name': 'auto_gaussdb_target',
        'connection_type': source_and_target,
        'database_host': '192.168.1.183',
        'database_port': '15437',
        'database_type': database_type,
        'database_name': "postgres",
        'database_owner': "target",
        'database_username': "gaussdb",
        "plain_password": "Gotapd8@"
    }

    # for auto
    auto_gaussdb_source_new = {
        'name': 'auto_gaussdb_source_new',
        'connection_type': source_and_target,
        'database_host': '192.168.1.183',
        'database_port': '15437',
        'database_type': database_type,
        'database_name': "source",
        'database_owner': "public",
        'database_username': "gaussdb",
        "plain_password": "Gotapd8@"
    }
    auto_gaussdb_target_new = {
        'name': 'auto_gaussdb_target_new',
        'connection_type': source_and_target,
        'database_host': '192.168.1.183',
        'database_port': '15437',
        'database_type': database_type,
        'database_name': "target",
        'database_owner': "public",
        'database_username': "gaussdb",
        "plain_password": "Gotapd8@"
    }

    auto_gaussdb_public = {
        'name': 'auto_gaussdb_public',
        'connection_type': source_and_target,
        'database_host': '192.168.1.183',
        'database_port': '15437',
        'database_type': database_type,
        'database_name': "postgres",
        'database_owner': "public",
        'database_username': "gaussdb",
        "plain_password": "Gotapd8@"
    }


class KunDB:
    database_type = 'kundb'
    # 没有可用的kundb数据源，使用mysql替代
    auto_kundb_source = {
        "name": "auto_kundb_source",
        "database_type": database_type,
        "database_host": "47.115.163.10",
        "database_port": "3306",
        "database_name": "kundb",
        "database_username": "root",
        "plain_password": "zsj@520wm",
        "connection_type": source_and_target
    }
    auto_kundb_target = {
        "name": "auto_kundb_target",
        "database_type": database_type,
        "database_host": "47.115.163.10",
        "database_port": "3306",
        "database_name": "kundb_target",
        "database_username": "root",
        "plain_password": "zsj@520wm",
        "connection_type": source_and_target
    }
    auto_kundb_source_test = {
        "name": "auto_kundb_source_test",
        "database_type": database_type,
        "database_host": "47.115.163.10",
        "database_port": "3306",
        "database_name": "kundb",
        "database_username": "root",
        "plain_password": "zsj@520wm",
        "connection_type": source_and_target
    }
    auto_kundb_public = {
        "name": "auto_kundb_public",
        "database_type": database_type,
        "database_host": "47.115.163.10",
        "database_port": "3306",
        "database_name": "kundb_public",
        "database_username": "root",
        "plain_password": "zsj@520wm",
        "connection_type": source_and_target
    }


class KUDU:
    database_type = 'kudu'

    auto_kudu_source = {
        'name': 'auto_kudu_source',
        'database_type': database_type,
        'connection_type': source_and_target,
        'database_host': '192.168.1.183:7051,192.168.1.183:7151,192.168.1.183:7251',
    }

    auto_kudu_target = {
        'name': 'auto_kudu_target',
        'database_type': database_type,
        'connection_type': target,
        'database_host': '192.168.1.183:7051,192.168.1.183:7151,192.168.1.183:7251',
    }

    kudu_data_source_test = {
        'name': 'kudu_data_source_test',
        'database_type': database_type,
        'connection_type': target,
        'database_host': '192.168.1.183:7051,192.168.1.183:7151,192.168.1.183:7251',
    }


class HBase:
    database_type = 'hbase'

    hbase_data_source_test = {
        "name": "hbase_data_source_test",
        "database_type": database_type,
        "connection_type": source,
        "database_host": "192.168.1.183",
        "database_port": "2181",
        "database_name": "default"

    }

    auto_hbase_source = {
        "name": "auto_hbase_source",
        "database_type": database_type,
        "connection_type": source,
        "database_host": "192.168.1.183",
        "database_port": "2181",
        "database_name": "default"

    }

    docker_hbase = {
        "name": "docker_hbase",
        "database_type": database_type,
        "connection_type": source,
        "database_host": "192.168.1.126",
        "database_port": "49161",
        "python_port": "49158",
        "database_name": "default"
    }


class Hive:
    # only target
    database_type = 'hive'

    target = {
        'name': 'target',
        'database_type': database_type,
        'connection_type': target,
        'database_host': '192.168.1.179',
        'database_port': '10000',
        'database_name': 'target',
        'database_username': 'hadoop',
        'hiveConnType': 'JDBC'
    }

    hive_data_source_test = {
        'name': 'hive_data_source_test',
        'database_type': database_type,
        'connection_type': target,
        'database_host': '192.168.1.179',
        'database_port': '10000',
        'database_name': 'hadoop',
        'database_username': 'hadoop',
        'hiveConnType': 'JDBC'
    }

    # very slow
    auto_hive_jdbc = {
        'name': 'auto_hive_jdbc',
        'database_type': database_type,
        'connection_type': target,
        'database_host': '192.168.1.179',
        'database_port': '10000',
        'python_port': '10000',
        'database_name': 'hadoop',
        'database_username': 'hadoop',
        'hiveConnType': 'JDBC'
    }

    # faster, but not support update, delete cdc event
    auto_hive_stream = {
        'name': 'auto_hive_stream',
        'database_type': database_type,
        'connection_type': target,
        'database_host': '192.168.1.179',
        'database_port': '9083',
        'python_port': '10000',
        'database_name': 'default',
        'database_username': 'hadoop',
        'hiveConnType': 'Stream'
    }


class DB2:
    database_type = 'db2'

    auto_db2_source_test = {
        "name": "auto_db2_source_test",
        "database_type": database_type,
        "connection_type": source,
        "database_host": "192.168.1.132",
        "database_port": "40024",
        "database_name": "TESTDB",
        "database_username": "db2inst1",
        "plain_password": "admin",
        "database_owner": "SOURCE",
        "node_name": "catalog00"
    }


class Mysql:
    database_type = "mysql"

    mysql_source_test = {
        "name": "mysql_source_test",
        "database_type": database_type,
        "database_host": "47.115.163.10",
        "database_port": "3306",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "zsj@520wm",
        "connection_type": source_and_target
    }

    auto_mysql_source = {
        "name": "auto_mysql_source",
        "database_type": database_type,
        "database_host": "47.115.163.10",
        "database_port": "3306",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "zsj@520wm",
        "connection_type": source_and_target
    }

    auto_mysql = {
        "name": "auto_mysql",
        "database_type": database_type,
        "database_host": "47.115.163.10",
        "database_port": "3306",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "zsj@520wm",
        "connection_type": source_and_target
    }

    auto_mysql_target = {
        "name": "auto_mysql_target",
        "database_type": database_type,
        "database_host": "47.115.163.10",
        "database_port": "3306",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "zsj@520wm",
        "connection_type": source_and_target
    }

    docker_mysql_5562 = {
        "name": "docker_mysql_5562",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33061",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "Gotapd8",
        "connection_type": source_and_target,
        'serve': {
            'docker': '4f7ceec847a6'
        }
    }

    lyl_mysql = {
        "name": "lyl_mysql",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33061",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "Gotapd8",
        "connection_type": source_and_target
    }

    docker_mysql_5651 = {
        "name": "docker_mysql_5651",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33062",
        "database_name": "INSURANCE",
        "database_username": "root",
        "plain_password": "Gotapd8",
        "connection_type": source_and_target
    }

    docker_mysql_5733 = {
        "name": "docker_mysql_5733",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33063",
        "database_name": "INSURANCE",
        "database_username": "root",
        "plain_password": "Gotapd8",
        "connection_type": source_and_target
    }

    docker_mysql_8023 = {
        "name": "docker_mysql_8023",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33064",
        "database_name": "INSURANCE",
        "database_username": "root",
        "plain_password": "Gotapd8",
        "connection_type": source_and_target
    }

    docker_mysql_8023_target = {
        "name": "docker_mysql_8023_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "33064",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "Gotapd8",
        "connection_type": source_and_target
    }

    all_list = [auto_mysql,
                auto_mysql_target,
                docker_mysql_5562,
                docker_mysql_5651,
                docker_mysql_5733,
                docker_mysql_8023]


class AdbMYSQL:
    database_type = "adb_mysql"

    adb_mysql_source_add_test = {
        "name": "adb_mysql_source_add_test",
        "database_type": database_type,
        "database_host": "am-wz9fru1lefwi6ieqt167320o.ads.aliyuncs.com",
        "database_port": "3306",
        "database_name": "tapdata",
        "database_username": "tapdata",
        "plain_password": "Gotapd8!",
        "connection_type": source
    }

    adb_mysql = {
        "name": "adb_mysql",
        "database_type": database_type,
        "database_host": "am-wz9fru1lefwi6ieqt167320o.ads.aliyuncs.com",
        "database_port": "3306",
        "database_name": "tapdata",
        "database_username": "tapdata",
        "plain_password": "Gotapd8!",
        "connection_type": source
    }


class Mariadb:
    database_type = "mariadb"

    mariadb_source_test = {
        "name": "auto_mariadb",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "43061",
        "database_name": "auto_mariadb",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target
    }

    auto_mariadb = {
        "name": "auto_mariadb",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "43061",
        "database_name": "auto_mariadb",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target
    }
    auto_mariadb_source = {
        "name": "auto_mariadb_source",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "43061",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source
    }
    auto_mariadb_target = {
        "name": "auto_mariadb_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "43061",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": target
    }


class MongoDB:
    database_type = "mongodb"

    USERQ = {
        "name": "USERQ",
        "database_type": database_type,
        "database_host": "47.115.163.10:27017",
        "database_port": "27017",
        "database_name": "tapclient_devops",
        "database_username": "",
        "plain_password": "",
        "connection_type": source_and_target
    }

    auto_mongo_source = {
        "name": "auto_mongo_source",
        "database_type": database_type,
        "database_host": "47.115.163.10:27017",
        "database_port": "27017",
        "database_name": "source",
        "database_username": "",
        "plain_password": "",
        "connection_type": source_and_target
    }
    auto_mongo_source2 = {
        "name": "auto_mongo_source2",
        "database_type": database_type,
        "database_host": "47.115.163.10:27016",
        "database_port": "27016",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target
    }

    auto_mongo_target = {
        "name": "auto_mongo_target",
        "database_type": database_type,
        "database_host": "47.115.163.10:27017",
        "database_port": "27017",
        "database_name": "target",
        "database_username": "",
        "plain_password": "",
        "connection_type": source_and_target
    }

    mongodb_source_test = {
        "name": "mongodb_source_test",
        "database_type": database_type,
        "database_host": "47.115.163.10:27017",
        "database_port": "27017",
        "database_name": "debug_mongo",
        "database_username": "",
        "plain_password": "",
        "connection_type": source_and_target,
        'additionalString': 'authSource=admin'
    }

    mongodb3221 = {
        "name": "mongodb3221",
        "additionalString": "authSource=admin",
        "database_type": database_type,
        "database_host": "192.168.1.183:23221",
        "database_port": "23221",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "Gotapd8",
        "connection_type": source_and_target
    }

    mongodb3424 = {
        "name": "mongodb3424",
        "database_type": database_type,
        "database_host": "192.168.1.183:23424",
        "database_port": "23424",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "Gotapd8",
        'additionalString': 'authSource=admin',
        "connection_type": source_and_target
    }

    mongodb3622 = {
        "name": "mongodb3622",
        "database_type": database_type,
        "database_host": "192.168.1.183:23622",
        "database_port": "23622",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "Gotapd8",
        'additionalString': 'authSource=admin',
        "connection_type": source_and_target
    }

    mongodb4023 = {
        "name": "mongodb4023",
        "database_type": database_type,
        "database_host": "192.168.1.183:24023",
        "database_port": "24023",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "Gotapd8",
        'additionalString': 'authSource=admin',
        "connection_type": source_and_target
    }

    lyl_mongo = {
        "name": "lyl_mongo",
        "database_type": database_type,
        "database_host": "192.168.1.183:24023",
        "database_port": "24023",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "Gotapd8",
        'additionalString': 'authSource=admin',
        "connection_type": source_and_target
    }

    mongodb4212 = {
        "name": "mongodb4212",
        "database_type": database_type,
        "database_host": "192.168.1.183:24212",
        "database_port": "24212",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "Gotapd8",
        'additionalString': 'authSource=admin',
        "connection_type": source_and_target
    }

    yun_source = {
        "name": "yun_source",
        "database_type": database_type,
        "database_host": "36.134.131.197:27029",
        "database_port": "27029",
        "database_name": "source",
        "database_username": "",
        "plain_password": "",
        'additionalString': 'authSource=admin',
        "connection_type": source_and_target
    }

    yun_target = {
        "name": "yun_target",
        "database_type": database_type,
        "database_host": "36.134.131.197:27029",
        "database_port": "27029",
        "database_name": "target",
        "database_username": "",
        "plain_password": "",
        'additionalString': 'authSource=admin',
        "connection_type": source_and_target
    }

    all_list = [USERQ,
                auto_mongo_source,
                auto_mongo_target,
                # mongodb3221,
                # mongodb3424,
                # mongodb3622,
                # mongodb4023,
                # mongodb4212
                ]


class Oracle:
    database_type = "oracle"
    others = {"tin_type": "SID", "thin_type": "SID"}

    oracle_132 = {
        "name": "oracle_132",
        "database_type": database_type,
        "database_host": "192.168.1.132",
        "database_port": "1521",
        "database_name": "tap11g132",
        "database_owner": "TAPDATA",
        "database_username": "tapdata",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        **others
    }

    lyl_oracle = {
        "name": "lyl_oracle",
        "database_type": database_type,
        "database_host": "192.168.1.132",
        "database_port": "1521",
        "database_name": "tap11g132",
        "database_owner": "TAPDATA",
        "database_username": "tapdata",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        **others
    }

    oracle_source_test = {
        "name": "oracle_source_test",
        "database_type": database_type,
        "database_host": "192.168.1.189",
        "database_port": "15212",
        "database_name": "ORCLCDB",
        "database_owner": "C##ZHANGXIN",
        "database_username": "c##zhangxin",
        "plain_password": "tapdata",
        "connection_type": source_and_target,
        **others
    }

    oracle_11g_USERQ = {
        "name": "oracle_11g_USERQ",
        "database_type": database_type,
        "database_host": "192.168.1.126",
        "database_port": "1521",
        "database_name": "tap11g",
        "database_owner": "USERQ",
        "database_username": "USERQ",
        "plain_password": "PlanQsuccesS!",
        "connection_type": source_and_target,
        **others
    }

    oracle_11g_fenqu = {
        "name": "oracle_11g_fenqu",
        "database_type": database_type,
        "database_host": "192.168.1.126",
        "database_port": "1521",
        "database_name": "tap11g",
        "database_owner": "TEST",
        "database_username": "USERQ",
        "plain_password": "PlanQsuccesS!",
        "connection_type": source_and_target,
        **others
    }

    oracle_122c_TAPDATA = {
        "name": "oracle_122c_TAPDATA",
        "database_type": database_type,
        "database_host": "192.168.1.126",
        "database_port": "1521",
        "database_name": "tap122c",
        "database_owner": "TAPDATA",
        "database_username": "TAPDATA",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        "database_datetype_without_timezone": "+00:00",
        **others
    }

    oracle_19c_TAPDATA = {
        "name": "oracle_19c_TAPDATA",
        "database_type": database_type,
        "database_host": "192.168.1.126",
        "database_port": "1521",
        "database_name": "tap19c",
        "database_owner": "TAPDATA",
        "database_username": "TAPDATA",
        "plain_password": "Gotapd8!",
        "database_password": "582d5cb45f75be4f670192ac1aabeec2",
        "connection_type": source_and_target,
        **others
    }

    oracle_niko_TAPDATA = {
        "name": "oracle_niko_TAPDATA",
        "database_type": database_type,
        "database_host": "192.168.1.189",
        "database_port": "15212",
        "database_name": "ORCLCDB",
        "database_owner": "C##ZHANGXIN",
        "database_username": "c##zhangxin",
        "plain_password": "tapdata",
        "connection_type": source_and_target,
        **others
    }
    all_list = [oracle_11g_USERQ,
                oracle_122c_TAPDATA]


class Postgres:
    database_type = "postgres"
    others = {
        "thin_type": "SID",
        "pgsql_log_decorder_plugin_name": "wal2json_streaming",
        "additionalString": "autosave=always&cleanupSavePoints=ture",
    }
    postgres_source_test = {
        "name": "postgres_source_test",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "15432",
        "database_name": "postgres",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }

    DWS_target = {
        "name": "DWS_target",
        "database_type": database_type,
        "database_host": "tapdata.dws.huaweicloud.com",
        "database_port": "8000",
        "database_name": "gaussdb",
        "database_owner": "public",
        "database_username": "dbadmin",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        **others
    }
    postgres_09426 = {
        "name": "postgres_09426",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "15432",
        "database_name": "postgres",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }

    postgres_5437 = {
        "name": "postgres_5437",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5437",
        "database_name": "postgres",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }

    postgres_9525 = {
        "name": "postgres_9525",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5433",
        "database_name": "postgres",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }
    postgres_9621 = {
        "name": "postgres_9621",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5434",
        "database_name": "postgres",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }
    postgres_1016 = {
        "name": "postgres_1016",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5435",
        "database_name": "postgres",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }
    postgres_1111 = {
        "name": "postgres_1111",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5436",
        "database_name": "postgres",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }
    postgres_1302 = {
        "name": "postgres_1302",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5438",
        "database_name": "postgres",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }
    # postgres_5437_source = {
    #     "name": "postgres_5437_source",
    #     "database_type": database_type,
    #     "database_host": "192.168.1.183",
    #     "database_port": "5437",
    #     "database_name": "source",
    #     "database_owner": "public",
    #     "database_username": "root",
    #     "plain_password": "Gotapd8#",
    #     "connection_type": source_and_target,
    #     **others
    # }

    postgres_5437_target = {
        "name": "postgres_5437_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5437",
        "database_name": "target",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }

    postgres_5437_target_2 = {
        "name": "postgres_5437_target_2",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "5437",
        "database_name": "target_2",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }

    postgres_09426_target = {
        "name": "postgres_09426_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "15432",
        "database_name": "target",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }
    postgres_09426_target_two = {
        "name": "postgres_09426_target_two",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "15432",
        "database_name": "target_two",
        "database_owner": "public",
        "database_username": "root",
        "plain_password": "Gotapd8#",
        "connection_type": source_and_target,
        **others
    }

    all_list = [postgres_09426,
                postgres_09426_target]


class AdbPostgres:
    database_type = "adb_postgres"
    others = {
        "thin_type": "SID",
        "pgsql_log_decorder_plugin_name": "wal2json_streaming"
    }
    adb_postgres_add_source_test = {
        "name": "adb_postgres_add_source_test",
        "database_type": database_type,
        "database_host": "gp-wz95oc7c2c3q798j4o-c-master.gpdb.rds.aliyuncs.com",
        "database_port": "5432",
        "database_name": "tapdata",
        "database_owner": "public",
        "database_username": "tapdata",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        **others
    }

    adb_postgres = {
        "name": "adb_postgres",
        "database_type": database_type,
        "database_host": "gp-wz95oc7c2c3q798j4o-c-master.gpdb.rds.aliyuncs.com",
        "database_port": "5432",
        "database_name": "tapdata",
        "database_owner": "public",
        "database_username": "tapdata",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        **others
    }
    adb_postgres_source = {
        "name": "adb_postgres_source",
        "database_type": database_type,
        "database_host": "gp-wz95oc7c2c3q798j4o-c-master.gpdb.rds.aliyuncs.com",
        "database_port": "5432",
        "database_name": "source",
        "database_owner": "public",
        "database_username": "tapdata",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        **others
    }
    adb_postgres_target = {
        "name": "adb_postgres_target",
        "database_type": database_type,
        "database_host": "gp-wz95oc7c2c3q798j4o-c-master.gpdb.rds.aliyuncs.com",
        "database_port": "5432",
        "database_name": "target",
        "database_owner": "public",
        "database_username": "tapdata",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        **others
    }


class Sqlserver:
    database_type = "sqlserver"
    others = {}

    sqlserver_source_test = {
        "name": "sqlserver_source_test",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "11434",
        "database_name": "master",
        "database_owner": "dbo",
        "database_username": "sa",
        "plain_password": "Gotapd8-",
        "connection_type": source_and_target
    }

    sqlserver_2019_no_cdc = {
        "name": "sqlserver_2019_no_cdc",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "11434",
        "database_name": "master",
        "database_owner": "dbo",
        "database_username": "sa",
        "plain_password": "Gotapd8-",
        "connection_type": source_and_target
    }

    sqlserver_2019_source = {
        "name": "sqlserver_2019_source",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "11434",
        "database_name": "source",
        "database_owner": "dbo",
        "database_username": "sa",
        "plain_password": "Gotapd8-",
        "connection_type": source_and_target
    }

    sqlserver_2019_target = {
        "name": "sqlserver_2019_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "11434",
        "database_name": "target",
        "database_owner": "dbo",
        "database_username": "sa",
        "plain_password": "Gotapd8-",
        "connection_type": source_and_target
    }

    sqlserver_2017_no_cdc = {
        "name": "sqlserver_2017_no_cdc",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "11433",
        "database_name": "master",
        "database_owner": "dbo",
        "database_username": "sa",
        "plain_password": "Gotapd8-",
        "connection_type": source_and_target
    }

    sqlserver_2017_source = {
        "name": "sqlserver_2017_source",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "11433",
        "database_name": "source_and_target",
        "database_owner": "dbo",
        "database_username": "sa",
        "plain_password": "Gotapd8-",
        "connection_type": source_and_target
    }
    all_list = [sqlserver_2019_target,
                sqlserver_2019_no_cdc,
                sqlserver_2019_source,
                sqlserver_2017_no_cdc]


class DM:
    """
    db :dm8db host:192.168.1.183:5236 superuser: sysdba/DMTAPD8!! user: tapdata/gotapdmdb
    """
    database_type = "dameng"
    others = {}
    dm_source_test = {
        "name": "dm_source_test",
        "database_type": database_type,
        "connection_type": target,
        "database_host": "192.168.1.183",
        "database_port": "52360",
        "database_name": "SOURCE",
        "database_owner": "SOURCE",
        "database_username": "sysdba",
        "plain_password": "Gotapd8!",
    }
    DM8_183_target = {
        "name": "DM8_183_target",
        "database_type": database_type,
        "connection_type": target,
        "database_host": "192.168.1.183",
        "database_port": "52360",
        "database_name": "TARGET",
        "database_owner": "TARGET",
        "database_username": "sysdba",
        "plain_password": "Gotapd8!",
    }
    all_list = [DM8_183_target]


class Greenplum:
    """
    "host：192.168.1.183
    port：26432
    user：gpadmin
    passwd：Gotapd8!"
    """
    database_type = "greenplum"
    others = {}
    Greenplum_source_test = {
        "name": "Greenplum_source_test",
        "database_type": database_type,
        "connection_type": source_and_target,
        "database_host": "192.168.1.183",
        "database_port": "26432",
        "database_name": "source",
        "database_owner": "public",
        "database_username": "gpadmin",
        "database_password": "",
        "plain_password": "gpadmin",
    }

    Greenplum_183_source = {
        "name": "Greenplum_183_source",
        "database_type": database_type,
        "connection_type": source_and_target,
        "database_host": "192.168.1.183",
        "database_port": "26432",
        "database_name": "source",
        "database_owner": "public",
        "database_username": "gpadmin",
        "database_password": "",
        "plain_password": "gpadmin",
    }
    Greenplum_183_target = {
        "name": "Greenplum_183_target",
        "database_type": database_type,
        "connection_type": source_and_target,
        "database_host": "192.168.1.183",
        "database_port": "26432",
        "database_name": "target",
        "database_owner": "public",
        "database_username": "gpadmin",
        "database_password": "",
        "plain_password": "gpadmin",
    }
    all_list = [Greenplum_183_source,
                Greenplum_183_target]


class Kafka:
    database_type = "kafka"
    others = {}

    kafka_source_test = {
        "name": "kafka_source_test",
        "database_type": "kafka",
        "kafkaBootstrapServers": "192.168.1.183:9092",
        "connection_type": "source_and_target",
        "kafkaPatternTopics": ".",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
    }

    kafka_183_all_topic = {
        "name": "kafka_183_all_topic",
        "database_type": "kafka",
        "kafkaBootstrapServers": "192.168.1.183:9092",
        "connection_type": "source_and_target",
        "kafkaPatternTopics": ".",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
    }

    kafka_183_all_topic_new_struct = {
        "name": "kafka_183_all_topic_new_struct",
        "database_type": "kafka",
        "kafkaBootstrapServers": "192.168.1.183:9092",
        "connection_type": "source_and_target",
        "kafkaPatternTopics": ".",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
        "new": True,
    }

    kafka_183_topic_a = {
        "name": "kafka_183_all_topic",
        "database_type": "kafka",
        "kafkaBootstrapServers": "192.168.1.183:9092",
        "connection_type": "source_and_target",
        "kafkaPatternTopics": "a",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
    }

    kafka_183_9093 = {
        "name": "kafka_183_9093",
        "database_type": "kafka",
        "kafkaBootstrapServers": "192.168.1.183:9093",
        "connection_type": "source_and_target",
        "kafkaPatternTopics": ".",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
    }

    kafka_183_19003 = {
        "name": "kafka_183_19003",
        "database_type": "kafka",
        "kafkaBootstrapServers": "192.168.1.183:19003",
        "connection_type": "source_and_target",
        "kafkaPatternTopics": ".",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
    }

    all_list = [kafka_183_all_topic,
                kafka_183_topic_a]


class ES:
    """
    192.168.1.189：9204   elastic
    """
    ...
    database_type = "elasticsearch"
    others = {}
    ES_SOURCE_TEST = {
        "name": "ES_SOURCE_TEST",
        "database_type": database_type,
        "connection_type": target,
        "database_host": "192.168.1.183",
        "database_port": "9200",
        "database_name": "",
        "database_username": "elastic",
        "database_password": "",
        "plain_password": "123456",
    }

    ES_189_target = {
        "name": "ES_189_target",
        "database_type": database_type,
        "connection_type": target,
        "database_host": "192.168.1.189",
        "database_port": "9204",
        "database_name": "",
        "database_username": "",
        "database_password": "",
        "plain_password": "",
    }

    ES_183_have_password = {
        "name": "ES_SOURCE_TEST",
        "database_type": database_type,
        "connection_type": target,
        "database_host": "192.168.1.183",
        "database_port": "9200",
        "database_name": "",
        "database_username": "elastic",
        "database_password": "",
        "plain_password": "123456",
    }


class ClickHouse:
    database_type = "clickhouse"

    ck_source_test = {
        "name": "ck_source_test",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        'python_port': '9002',
        "database_port": "9123",
        "database_name": "default",
        "database_username": "default",
        "plain_password": "Gotapd8!!",
        "connection_type": target
    }

    auto_ck_target = {
        "name": "auto_ck_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        'python_port': '9002',
        "database_port": "9123",
        "database_name": "target",
        "database_username": "default",
        "plain_password": "Gotapd8!!",
        "connection_type": target
    }


class TiDB:
    database_type = "tidb"

    tidb_source_test = {
        "name": "tidb_source_test",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "4000",
        "database_name": "test",
        "database_username": "root",
        "plain_password": "",
        "connection_type": source_and_target,
        'tidbPdServer': "http://192.168.1.183:2379"
    }

    AUTO_TIDB_SOURCE = {
        "name": "AUTO_TIDB_SOURCE",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "4000",
        "database_name": "source",
        "database_username": "root",
        "plain_password": "",
        "connection_type": source_and_target,
        'tidbPdServer': "http://192.168.1.183:2379"
    }

    AUTO_TIDB_TARGET = {
        "name": "AUTO_TIDB_TARGET",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "4000",
        "database_name": "target",
        "database_username": "root",
        "plain_password": "",
        "connection_type": source_and_target,
        'tidbPdServer': "http://192.168.1.183:2379"
    }


class HANA:
    database_type = "hana"

    hana_source_multi_tenant = {
        "name": "hana_source_multi_tenant",
        "database_type": database_type,
        "database_host": "192.168.1.128",
        "database_port": "39013",
        "database_name": "ZSJ",
        'database_owner': "SOURCE",
        "database_username": "SYSTEM",
        "plain_password": "dcCf4nL@",
        "connection_type": source_and_target,
        'hanaType': "mdc"
    }

    hana_source_test = {
        "name": "hana_source_test",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "39018",
        "database_name": "SOURCE",
        "database_username": "SYSTEM",
        "plain_password": "Gotapd8!",
        "connection_type": target,
        'hanaType': "sdc",
    }

    auto_hana = {
        "name": "auto_hana",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "39017",
        "database_name": "SOURCE",
        "database_username": "SYSTEM",
        "plain_password": "Gotapd8!",
        "connection_type": target,
        'hanaType': "sdc",
    }

    auto_hana_source = {
        "name": "auto_hana_source",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "39017",
        "database_name": "SOURCE",
        "database_owner": "SOURCE",
        "database_username": "SYSTEM",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        'hanaType': "sdc",
    }

    auto_hana_target = {
        "name": "auto_hana_target",
        "database_type": database_type,
        "database_host": "192.168.1.183",
        "database_port": "39017",
        "database_name": "TARGET",
        "database_owner": "TARGET",
        "database_username": "SYSTEM",
        "plain_password": "Gotapd8!",
        "connection_type": source_and_target,
        'hanaType': "sdc",
    }


class MQ:
    database_type = 'mq'
    # for auto test
    ActiveMQ_source_and_target = {
        "name": "ActiveMQ_source_and_target",
        'database_type': database_type,
        'connection_type': source_and_target,
        'mqType': '0',
        'brokerURL': 'tcp://192.168.1.183:61616',
        'pythonURL': 'tcp://192.168.1.183:61613',
        'mqUserName': 'admin',
        'mqPassword': 'admin',
        "mqQueueSet": ['zsj'],
        "mqTopicSet": [],
        "isUrl": True,
    }

    Rabbit_only_for_auto = {
        'name': 'Rabbit_only_for_auto',
        'database_type': database_type,
        'connection_type': source_and_target,
        'database_host': '192.168.1.183',
        'database_port': '15674',
        'mqType': '1',
        'mqUserName': 'admin',
        'mqPassword': 'admin',
        'mqQueueSet': ['zsj'],
        'virtualHost': "/"
    }

    Rocket_only_for_auto = {
        'name': 'Rocket_only_for_auto',
        'database_type': database_type,
        'connection_type': source_and_target,
        'database_host': '192.168.1.126',
        'database_port': '9876',
        'mqType': '2',
        'mqUserName': '',
        'mqPassword': '',
        'mqQueueSet': [],
        'mqTopicSet': ['zsj']
    }
